package com.example.demo.interceptor;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WJ
 * Date: 2023-02-13
 * Time: 18:23
 */

// 对异常进行统一处理
//@RestControllerAdvice
//public class ExceptionInterceptor {
//
//    @ExceptionHandler(Exception.class)
//    public Object exceptionInterceptor(Exception e){
//        HashMap<String,Object> map = new HashMap<>();
//        map.put("result","fail");
//        map.put("data","");
//        map.put("msg","异常信息:"+e.getMessage());
//        return map;
//    }
//}
